home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / Photoshop 4.0 SDK r2 Mac / Examples / Export / Outbound / OutboundUIMac.c < prev   
Encoding:
C/C++ Source or Header  |  1996-09-24  |  2.5 KB  |  104 lines  |  [TEXT/CWIE]

  1. /*
  2.     File: OutboundUIMac.c
  3.  
  4.     Copyright (c) 1993-6, Adobe Systems Incorporated.
  5.     All rights reserved.
  6.  
  7.     C source file for Mac Specific code for Outbound export module.
  8. */
  9.  
  10. #include "Outbound.h"
  11.  
  12. /*****************************************************************************/
  13.  
  14. /* Displays the about dialog box for the plug-in module. */
  15.  
  16. void DoAbout (GPtr globals)
  17. {
  18.     ShowAbout (gStuff->hostSig, AboutID);
  19. }
  20.  
  21. /*****************************************************************************/
  22.  
  23. Boolean QueryForExportFile (GPtr globals)
  24. {
  25.     
  26.     Str255                 prompt;
  27.     StandardFileReply    reply;
  28.     FSSpec                *specPtr;
  29.     Boolean                wasChanged;
  30.     int32                gotErr = 0;
  31.     
  32.     gotErr = PISetSaveDirectory((Handle)gAliasHandle,
  33.                                 gStuff->filename, 
  34.                                    gQueryForParameters,
  35.                                   &gStuff->vRefNum);
  36.     PIDisposeHandle((Handle)gAliasHandle); // it was handed to us, it's ours to dispose
  37.  
  38.     if (!gAliasHandle && !gQueryForParameters)
  39.         return FALSE; // no alias and no query?  Bad.
  40.  
  41.     gAliasHandle = NULL; // just in case
  42.     
  43.     if (!gQueryForParameters)
  44.         return TRUE; // got the aliashandle
  45.             
  46.     /* Ask the user */
  47.  
  48.     PIGetString(prompt, kPrompt);
  49.  
  50.     StandardPutFile (prompt, gStuff->filename, &reply);
  51.     
  52.     if (!TSC (!reply.sfGood))
  53.         return FALSE;
  54.     else
  55.     {
  56.         specPtr = &reply.sfFile;
  57.     
  58.         if (!(gSameNames = (PISMatch(specPtr->name, (char *)gStuff->filename) != noMatch)))
  59.             PICopy(gStuff->filename, specPtr->name, (specPtr->name[0]+1));
  60.             // shove user-defined name into gStuff filename
  61.                     
  62.         /* set gStuff->vRefNum as working directory (alias) from vRefNum
  63.               from hard vRefNum/parID */
  64.         PICloseAndOpenWD(specPtr->vRefNum, specPtr->parID, &gStuff->vRefNum);
  65.     
  66.         return TRUE;
  67.     }
  68. }
  69.  
  70. /*****************************************************************************/
  71.  
  72. Boolean CreateExportFile (GPtr globals)
  73. {
  74.     ResType    creator;
  75.     ResType type;
  76.     Str255    s = "";
  77.     
  78.     PIGetString(s, kCreatorAndType);
  79.     creator = PIChar2Type((char *)&s[1]);
  80.     type = PIChar2Type((char *)&s[5]);
  81.     
  82.     return PICreateFile(gStuff->filename, 
  83.                         gStuff->vRefNum, 
  84.                         creator,
  85.                         type, 
  86.                         &gFRefNum,
  87.                         &gResult);
  88. }
  89.  
  90. /*****************************************************************************/
  91.  
  92. Boolean CloseExportFile (GPtr globals)
  93. {
  94.     return PICloseFile(gStuff->filename,
  95.                        gStuff->vRefNum,
  96.                        gFRefNum,
  97.                        gSameNames,
  98.                        &gStuff->dirty,
  99.                        &gAliasHandle,
  100.                        &gResult);    
  101. }
  102.     
  103. /*****************************************************************************/
  104.